﻿using System.Data.Entity.ModelConfiguration;

using NeGroid.ChampionshipManager.Core;

namespace NeGroid.ChampionshipManager.Persistance.Mappings
{
	public class TeamMap : EntityTypeConfiguration<Team>
	{
		public TeamMap()
		{
			HasKey(t => t.Id);

			Property(t => t.Name)
				.HasMaxLength(100)
				.IsRequired();
			Property(t => t.Description)
				.HasMaxLength(1000)
				.IsOptional();
			Property(t => t.IconImage)
				.IsRequired();
			HasRequired(t => t.Captain)
				.WithOptional()
				.WillCascadeOnDelete(false);

			ToTable("Teams");
		}
	}
}
